#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include <Square.h>

USING_MOCKCPP_NS
USING_TESTNGPP_NS

FIXTURE(Square)
{
	TEST(should be able to calculate the area of the square(4))
	{
		Square square(4);

		ASSERT_EQ(16, square.getArea());
	}

	TEST(should be able to calculate the perimeter of the square(5))
	{
		Square square(5);

		ASSERT_EQ(20, square.getPerimeter());
	}

	TEST(should NOT be able to calculate the perimeter of the square(5.567))
	{
		Square square(5.567);

		ASSERT_NE(0, square.getPerimeter());
	}

	TEST(should be able to calculate the perimeter of the square(5.67) = 22.68)
	{
		Square square(5.67);

		ASSERT_EQ((float)22.68, square.getPerimeter());
	}

	TEST(should be able to calculate the area of the square(5.67) = 32.1489)
	{
		Square square(5.67);

		ASSERT_EQ((float)32.15, square.getArea());

		ASSERT_EQ(square.getRoundup(5.67 * 5.67), square.getArea());
	}

	TEST(should be able to calculate the area of the square(5.678) = 32.1489)
	{
		Square square(5.678);

		ASSERT_EQ((float)32.15, square.getArea());

		ASSERT_EQ(square.getRoundup(5.67 * 5.67), square.getArea());
	}

	TEST(test reset side len)
	{
		Square square(5.67);

		ASSERT_EQ(square.getRoundup(5.67 * 5.67), square.getArea());

		ASSERT_EQ(square.getRoundup(4 * 5.67), square.getPerimeter());

		ASSERT_EQ(true, square.setSquareSide(6.78));

		ASSERT_EQ(square.getRoundup(6.78 * 6.78), square.getArea());

		ASSERT_EQ(square.getRoundup(4*6.78), square.getPerimeter());
	}
};


